Always pass the right state in style context getters
authorMatthias Clasen <mclasen@redhat.com>
Sun, 15 Nov 2015 00:03:57 +0000 (19:03 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 15 Nov 2015 00:03:57 +0000 (19:03 -0500)
Otherwise, we are causing warnings that break make check.

testsuite/gtk/firefox-stylecontext.c
testsuite/gtk/stylecontext.c

index 0e5ce78f8886c120b4da62a0c9586e2e8fcd8309..3f0bd69d214c7edc483c94bfef04817c01d8fee7 100644 (file)
@@ -26,7 +26,7 @@ test_init_of_theme (void)
 
   /* Get the color. This should be initialized by the theme and not be
    * the default. */
-  gtk_style_context_get_color (context, 0, &before);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &before);
 
   /* Add a style that sets a different color for this widget.
    * This style has a higher priority than fallback, but a lower 
@@ -41,7 +41,7 @@ test_init_of_theme (void)
   g_object_unref (provider);
 
   /* Get the color again. */
-  gtk_style_context_get_color (context, 0, &after);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &after);
 
   /* Because the style we added does not influence the color,
    * the before and after colors should be identical. */
index f0381bb5d2d75ef18a6b00700fb47a361e8b5e91..25c3881eecef383ba16f9114012ec47f80e2be6c 100644 (file)
@@ -173,14 +173,14 @@ test_match (void)
   data = "* { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
          "GtkButton { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -188,14 +188,14 @@ test_match (void)
          "GtkWindow > GtkButton { color: #000 }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
          ".button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -203,7 +203,7 @@ test_match (void)
          ".button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -211,7 +211,7 @@ test_match (void)
          "GtkWindow GtkButton { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -219,7 +219,7 @@ test_match (void)
          "GtkWindow .button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -227,7 +227,7 @@ test_match (void)
          "#mywindow .button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -235,7 +235,7 @@ test_match (void)
          "GtkWindow#mywindow .button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -243,7 +243,7 @@ test_match (void)
          "GObject .button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   data = "* { color: #f00 }\n"
@@ -252,7 +252,7 @@ test_match (void)
          "GtkWindow:active .button { color: #fff }";
   gtk_css_provider_load_from_data (provider, data, -1, &error);
   g_assert_no_error (error);
-  gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+  gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
   g_assert (gdk_rgba_equal (&color, &expected));
 
   g_object_unref (provider);
@@ -273,7 +273,7 @@ test_basic_properties (void)
   gtk_style_context_set_path (context, path);
   gtk_widget_path_free (path);
 
-  gtk_style_context_get (context, 0,
+  gtk_style_context_get (context, gtk_style_context_get_state (context),
                          "color", &color,
                          "background-color", &bg_color,
                          "font", &font,